Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

184
Vistas
Insecure CSP value "'unsafe-eval'" in directive 'script-src'

while trying to load a third-party js file into content scripts in chrome extension. I'm facing an unsafe-eval error

My manifest.json looks like this

{
    "manifest_version": 3,
    "name": "Test",
    "version": "1.0",
    "host_permissions": ["https://mail.google.com/"],
    "content_scripts": [
        {
            "matches": [
                "https://mail.google.com/*"
            ],
            "js": ["3rdparty.js", "code.js"],
            "run_at": "document_end"
        }
    ]
}

after loading I'm receiving this error

Error logged: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".

so, I have tried adding csp to the manifest file

{
...,
"content_security_policy": {
    "extension_pages": "script-src 'self' 'unsafe-eval'; object-src 'self'"
  }
}

then I'm receiving this error in chrome telling that its unable to load the extension

'content_security_policy.extension_pages': Insecure CSP value "'unsafe-eval'" in directive 'script-src'.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I'm afraid you cannot use 'unsafe-eval' in manifest version 3

Are you executing remote code or arbitrary strings? You can no longer execute external logic using chrome.scripting.executeScript({code: '...'}), eval(), and new Function().

You have to move all your script into remote or local files. You may generate scripts on a remote file (eg. php) and execute it using chrome.scripting.executeScript instead of using eval() or consider migrating back to MV2.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda